Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Introduction
The OpenDoc Name Binding subsystem is responsible for determining what part editor or part viewer, of those installed on user's system, is to be loaded in order to edit or view a given part or document. The binding process uses information gathered from 'nmap' resources found in any installed editors or viewers. Please see the OpenDoc Human Interface Guidelines for information on the installation of OpenDoc and of part editors. This document decribes OpenDoc 'nmap' resources and provideds sample 'nmap' code.
Terms used and definitions
Kind - the Kind is a string (ISO Type format) which is used to identify a data format. Examples of Kinds may be “SurfCorp:SurfText”, “SurfCorp:Picture:BlackAndWhite”, “ SurfCorp:Picture:Color”
Category - kinds can be grouped together in one or more categories. Examples of Categories: “OpenDoc:Category:Text”, “OpenDoc:Category:Graphics”, “OpenDoc:Category:Table”. Kinds may be in more than one category.
Part Editor - a Part Editor is a dynamically linked library which has the ability to manipulate (read, Sample, edit, print, write) a number of different Kinds of Parts. Since the context implies it, “editor” is often used instead of “part editor”. An editor is said to exist, or to be, if it has been installed.
Part Viewer - a Part Viewer is a Part Editor which is not capable of changing the contents of Parts.
Binding - Binding is the act of taking a Part and assigning a Part Editor to it at run time. Unbound - without a binding (to an Editor).
Fidelity - different Kinds of data can be said to represent the same information, but some may be qualitatively better or worse than others. A qualitatively better Kind is said be of higher Fidelity. There is no universal ordering of Kinds by Fidelity, therefore Fidelity is always determined by a particular context. Part Editors support many different Kinds, and stored with the Part Editor is a list of those Kinds in Fidelity ordering Parts may contain many different Kinds, different representations of their content, and they are Fidelity ordered by what the Part Editor which last wrote out that part considers Fidelity.
Editor ID - Is the System Objects Model (SOM) Class ID of a Part object. Its format is simply <module>::<class name>. The module and class name are defined in a part's .idl file. The one for Editor Setup, for example, now looks like Apple::ODEditorSetup.
Viewer ID-the same as an EditorID, only for part viewers.
Recipe
In order for Binding to work, part-editors are required to contain structures that describe the Editor's ID and the Kind and Category of the data that the editor can edit. On the Macintosh, these structures exist in the form of 'nmap' resources found in each Part Editor's shared library file. These resources are used by OpenDoc to construct a set of look-up tables for this information when a document is first opened.
Specifying a Part Editor'sSupported Kinds
Part editors are required by OpenDoc to contain an EditorKinds ‘nmap’. It will need to contain a list of Editor IDs each followed by a list of kinds that are supported by that editor. The kinds are to be listed in order of fidelity for an editor. Please see the Multiple Kind Support Recipe for information on how an editor can support more than one kind and for information on fidelity ordering. Notice that multiple editors could exist in one library, so that in this resource each editor would map to its list of kinds. The table below shows what this list would look like.
Editor Kinds
editorID1 kind kind2 … kindn
editorID2 …
.
.
.
editorIDn …
Categorizing Each Kind
Part editors are also required by OpenDoc to contain an KindCategories ‘nmap’. Each kind that an editor supports belongs to a category. The KindCategories ‘nmap’ contains a list of each kind followed by an unordered list of categories that the kind belongs to. The table below shows what this list would look like.
Kind Categories
Kind1 category 1 category 2 … categoryn
Kind2 …
.
.
.
kindn …
Creating User-visible Strings
The next three tables illustrate the next three ‘nmap’ resources that part editors are required to contain. They are used to map kind, category, and editor ID ISO strings to user-visible strings. In the first table, each kind is mapped to a corresponding user-visible string. The second and third tables illustrate similar mappings for categories and editor IDs. It is IMPORTANT to note that it is not necessary to provide Category user strings for OpenDoc standard categories. OpenDoc already provides these.
Kind User String
kind1 kind1userstring
kind2 kind2userstring
.
.
.
kindn kindnuserstring
Category User String
category1 cateory1userstring
category2 cateory2userstring
.
.
.
categoryn cateorynuserstring
Editor User String
editorID1 editorID1userstring
editorID2 editorID2userstring
.
.
.
editorIDn editorIDnuserstring
Specifying Macintosh File Type Information
The last ‘nmap’ that is required for all part editors is the KindMacOSType ‘nmap’. This table maps OpenDoc kinds to Macintosh file types. It will be used to determine the icon to be associated with each OpenDoc kind. This table is not to be confused with the EditorPlatformKinds ‘nmap’ that will describe to OpenDoc which Standard Mac Kinds an editor can edit. That ‘nmap’ is described later in this document. The following table describes the KindMacOSType ‘nmap’.
Kind OSType
kind1 OSType
kind2 OSType
.
.
.
kindn OSType
Supporting Standard Macintosh Data Types
The EditorPlatformKinds ‘nmap’ is only required by those part editors that have the capability to support any Standard Mac Kinds. This ‘nmap’ will describe to OpenDoc which Standard Mac Kinds an editor can edit. DO NOT include Standard Mac Kinds in your normal EditorKinds 'nmap' resource.
An OpenDoc Editor which ONLY supports standard Macintosh Kinds is a special case. It should NOT contain the following 'nmap' resources described above: Editor Kinds, Kind Categories, Kind User String, and Category User String.
Please see the Multiple Kind Support Recipe for more information on how an editor can support Standard Mac Kind data.
The EditorPlatformKinds ‘nmap’ will provide a list of PlatformTypeSpaces for every editor in the shared library. A PlatformTypeSpace will contain four things: a PlatformTypeSpace type (either file or data), the Macintosh file or data OSType, a user-string for the type, and the category that the type belongs to. There are only two PlatformTypeSpace types, kODPlatformFileType and kODPlatformDataType indicating a file or a data type supported by the editor. The following table describes the EditorPlatformKinds ‘nmap’.
In order for an Editor to provide AppleGuide support two things must be in place. First, AppleGuide GuideFiles must be installed for each Editor in the same folder as the shared library that contains the Editor or set of Editors. Second, the shared library must include an 'nmap' resource that specifies the help file name or names. The following table describes the help file 'nmap'.
Editor Help File Name
editorID1 helpFileName1
editorID2 helpFileName2
.
.
.
editorIDn helpFileNamen
Part Viewers
Part Viewer libraries are required to include a additional ‘nmap’ resource indicating to OpenDoc that they are viewers and not regular part editors. The PartViewers ‘nmap’ simply includes a list of viewerIDs for each viewer in the library and their corresponding viewer types. Currently, there is only one viewer type, kODSimpleViewer. The following table describes the PartViewers ‘nmap’.
Viewer
viewerID1 kODSimpleViewer
viewerID2 kODSimpleViewer
.
.
.
viewerIDn kODSimpleViewer
Container Suites
Container Suite libraries are only required to have one ‘nmap’, the ContainerSuite ‘nmap’. This resource will contain a list of contianer types mapped with container suite class IDs. The following table describes the ContainerSuite ‘nmap’.
Container Type Container Suite
container Type1 containerSuiteID1
container Type2 containerSuiteID2
.
.
.
contianer Typen containerSuiteIDn
Coding Required
Six 'nmap' resources are required for each part-editor to describe each of the above name space tables. The 'nmap' containing the Editor Kinds Supported data will also be an array of ISO String lists. A sample resource definition looks like:
The next three ‘nmap’s, Kind user strings, Category user strings and Editor user strings, contain lists of mappings between internal ISO Strings and user-visible International Text strings. Sample resources definitions looks like:
kSamplePartID, /* Editor class ID (SOM class ID) */
kODIsINTLText { /* International String */
smRoman,
langEnglish,
kSampleEditorUserString
}
}
};
The Old Macintosh OSType nmap contains a list of mappings between the new OpenDoc kind and the old Macintosh file type. A sample resource definition looks like:
The EditorPlatformKinds ‘nmap’ is only required by those editors that are capable of editing Standard Mac Kinds. A sample EditorPlatformKinds nmap definition looks like: